package com.example.zhu.Mapper;

import com.example.zhu.dto.Employee;
import com.example.zhu.dto.Member;
import com.example.zhu.dto.MyPage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MemberMapper {
    @Select("SELECT * FROM member WHERE name LIKE #{name}")
    List<Member> getNameList(String name);
    @Select("SELECT * FROM member WHERE mobile LIKE #{phone}")
    List<Member> getPhoneList(String phone);
    @Select("select * from member order by update_time DESC limit #{min}, #{max}")
    List<Member> getAllList(MyPage page);
    @Select("select count(id) from member")
    int getAllListCount();
    @Select("select * from member where id = #{id}")
    Member selectById(Member member);
    @Update("update member set name = #{name}, mobile = #{mobile}, gender = #{gender}, update_time = #{updateTime},user_money=#{userMoney},frozen_money=#{frozenMoney} where id = #{id}")
    void updataById(Member member);
    @Insert("insert into member(name,mobile,gender,create_time,update_time,user_money,frozen_money) values(#{name},#{mobile},#{gender},#{createTime},#{updateTime},#{userMoney},#{frozenMoney})")
    void Insert(Member member);
    @Delete("delete from member where id = #{id}")
    void Delect(Member oldMember);
    @Select("select * from member where mobile like #{mobile}")
    List<Member> selectByMember(Member member);
}

